package com.eightbears.beboy.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.eightbears.beboy.entity.ShopCommentEntity;
import com.eightbears.beboy.R;
import com.eightbears.beboy.base.util.CommonUtils;

/**
 * Created by Bao on 2016/12/7.
 */

public class ShopCommentAdapter extends BaseQuickAdapter<ShopCommentEntity.ShopComment, BaseViewHolder> {



    public ShopCommentAdapter() {
        super(R.layout.item_shop_comment, null);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, ShopCommentEntity.ShopComment shopComment) {

        CommonUtils.loadImageView(mContext, shopComment.getUser().getCover(), R.mipmap.default_head,
                (ImageView) baseViewHolder.getView(R.id.iv_user_head));
        baseViewHolder.setText(R.id.tv_nickname, shopComment.getUser().getNickname())
                .setText(R.id.tv_date, CommonUtils.TimeStamp2Date(shopComment.getCommented_at(), "MM-dd HH:mm"))
                .setText(R.id.tv_content, shopComment.getComment())
                .setRating(R.id.rb_start, shopComment.getScore())
                .addOnClickListener(R.id.iv_user_head);
    }

}
